The Beginning
I've spent most of my life immersed in the world of computing. It does seem a little strange to me, in retrospect, that it's only in the last two years that I've really been getting into programming. I guess I've historically been a support guy, both Jamie and I being the go-to computer problem solvers in our families ever since we were kids.
It felt only natural for me to get into support as a career. I still work in the field and I still like my job, even if it drives me a bit crazy. But I've had the overwhelming desire slowly growing in me to start solving problems my own way.
Fear and Loathing in a college bookstore
In college, I got a job in the bookstore. I had to search the database for items that had not been ordered recently and delete them. I know now that a few SQL commands could have done the job in seconds, and this job only existed to fulfill some college dictum about employing students. But back then I was empowered.
I was given free reign of the inventory database. Of course they could see logs of everything I did, and they had me keep my own records of my actions. But I was a god. Like Judge Dredd, I moved relentlessly through the archives, reviewing inventory items and rendering verdicts. Offending items were cataloged on a meticulous spreadsheet and then expunged.
I worked with fury and determination for a whole hour. I woke up sometime in the afternoon, cramped, grumpy, and numb in my lumpy chair, sitting in a forgotten cubicle behind some old signs and boxes in the darkest corner of the book store office. I tried to apply myself, but the boredom piled on and the hours stretched to eternity. The screaming pain shooting up my arm from endlessly pushing the mouse back and forth across the screen like some cruel Sisyphean punishment, the weird ticking sound coming at frustratingly irregular intervals from that old fridge near my desk, and the endless parade of forgotten inventory entries all began to erode the once formidable walls of my sanity.
I began to search for a way out, without interrupting my minimum wage revenue stream. I mused on a few ideas, but ultimately I didn't think a really bad papercut could possibly give me a shot at ambulance chasing my way out of student debt, so I looked elsewhere.
Blame Autohotkey
Then I found it, a shining beacon in a world of sadness and misery. Autohotkey. This wonderful piece of software allowed me to script keyboard and mouse commands to do the repetitive work for me. For example:
F4::
click, 100, 200
sleep 1000
send o hi mark{enter}
return
The following commands will click on a position on the screen 100 pixels down and 200 in, from the top left corner of the screen. Then it will wait 1000 milli-seconds(one normal second), and type "oh hi mark" followed by pressing enter. The list of capabilities AHK is astounding. It can read/write files, commune with Excel using COM objects, and has expressions!
I was empowered again. A few hours and some denial and error was all it took to boil the entire job down to a simple button press. The script would open the next item in the list and await my judgement. One key was life, the other, death. After the decision was made, the item was either safe or expunged, and the next item brought forth.
Out in the world
After graduating, I began to make my own way in the world. I found a measurable volume of success in a telecom company that specializes in supporting hospitals and long-term care homes. Both on the job and in my spare time, I began to write small scripts and programs here and there to do simple tasks for me. Over time it grew into an obsession. I dabbled in modding Factorio for about five minutes, but quickly realized that a better understanding of programming was needed before I could make anything meaningful.
I began to seek out online sources of self-teaching. There is no particular resource I can point to and say "that was the ONE"; rather it's been a long series of tutorials and sample code in numerous languages, mainly Python, Lua, C.
...and you get a label, and you get a label, and you get a label!
The turning point was the label project. My Lego collection grows like foot fungus. You remember the day it first appeared, but back then it was only a small entity you could casually ignore, hoping it wouldn't become a larger problem. Over time, your tolerance for the discomfort it causes wanes and you decide you need to take action. However in the interim it somehow became a leviathan that you are not equipped to vanquish.
It became apparent the something must be done when the blue toboggan that held half of my Lego in a pile under the kitchen table began to overflow. The journey of it's maturity from a pile on the floor to the highly organized system that fills my dinning room has been well documented by Jamie in this post here.
Back in the fall of 2017, it became apparent that the drawers needed labels. We evaluated many different approaches, ranging from traditional hand-held printer labels, to more uhhh, interesting, methods like gluing bricks to the drawers to tease their contents, or making an index using color coded swatches and white sample bricks.
Finally we decided to just print stick-on labels. We found quite a few solutions online, but none we liked. Then I found this brick odyssey article.(As of the writing of this post, the site certificate has expired, click at your own risk!) We spent an entire weekend tweaking and hacking away at the code from brick odyssey until we had a python program that would batch render labels the way we wanted.
The results were fantastic. The labels turned out quite nice, but more importantly we were high on success. We had become gods walking among the plebeians. Now we were sure that writing software was not only something we wanted to do, but something we may be able to do well, someday.
A programmer is me!
In January of 2018, Jamie and I discovered a blog by Jacques Matheij about his own Lego sorting machine. We were inspired. We talked into the nether hours of the night, debating the practical realities of our own existence and the limits of our own capability. We then decided to kick logic to the curb and do the impossible. We would build our own machine. We would learn to program like professionals, and not just walk, but live like gods among the plebeians of the world.
We found an excellent online course about machine learning from the fine folks over at fast.ai, which helped us learn the basics of neural networks and how to get a simple model running in a relatively short time. Currently it is able to tell the difference between plates and bricks, with about 95% accuracy. This is the equivalent of the Hobbits reaching Bree, in terms of completeness, but we are excited and hopeful nonetheless. Further updates on the status of the project will come in future blog posts.
The project currently exists mostly in Python and C for Arduino. I am actually enjoy learning C much more than I initially thought I would. I had assumed that being an older and simpler language, and me being already more familiar with Python, that I would find C to be arcane and esoteric. In reality, I am finding it challenging in the best way, and the relative simplicity is refreshing. The obstinance of the language(compared to Python) demands that I learn its tools in great depth to use them effectively.
I eagerly await the day I graduate this legendary language and begin my journey into C++.
Turns out C for Arduino is basically just C++ with all the OS specific features removed. Either way, I'm still eager to learn the language in more depth and to start using it for PC software in addition to Arduino.
- Peter